.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "OGRMERGE" "1" "Apr 02, 2024" "" "GDAL"
.SH NAME
ogrmerge \-  Merge several vector datasets into a single one.
.SH SYNOPSIS
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
ogrmerge.py [\-\-help] [\-\-help\-general]
            \-o <out_dsname> <src_dsname> [<src_dsname>]...
            [\-f format] [\-single] [\-nln <layer_name_template>]
            [\-update | \-overwrite_ds] [\-append | \-overwrite_layer]
            [\-src_geom_type <geom_type_name>[,<geom_type_name>]...]
            [\-dsco <NAME>=<VALUE>]... [\-lco <NAME>=<VALUE>]...
            [\-s_srs <srs_def>] [\-t_srs <srs_def> | \-a_srs <srs_def>]
            [\-progress] [\-skipfailures] [\-\-help\-general]
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Options specific to the \fI\%\-single\fP option:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
[\-field_strategy FirstLayer|Union|Intersection]
[\-src_layer_field_name <name>]
[\-src_layer_field_content <layer_name_template>]
.ft P
.fi
.UNINDENT
.UNINDENT
.SH DESCRIPTION
.sp
New in version 2.2.

.sp
\fBogrmerge.py\fP script takes as input several vector datasets,
each of them having one or several vector layers, and copy them in
a target dataset.
.sp
There are essentially two modes:
.INDENT 0.0
.IP \(bu 2
the default one, where each input vector layer, is copied as a
separate layer into the target dataset
.IP \(bu 2
another one, activated with the \-single switch, where the content of
all input vector layers is appended into a single target layer. This
assumes that the schema of those vector layers is more or less the
same.
.UNINDENT
.sp
Internally this generates a \fI\%VRT \-\- Virtual Format\fP file, and if the
output format is not VRT, final translation is done with \fBogr2ogr\fP
or \fBgdal.VectorTranslate()\fP\&. So, for advanced uses, output to VRT,
potential manual editing of it and \fBogr2ogr\fP can be done.
.INDENT 0.0
.TP
.B \-\-help
Show this help message and exit
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help\-general
Gives a brief usage message for the generic GDAL commandline options and exit.
.UNINDENT
.INDENT 0.0
.TP
.B \-o <out_dsname>
Output dataset name. Required.
.UNINDENT
.INDENT 0.0
.TP
.B <src_dsname>
One or several input vector datasets. Required
.UNINDENT
.INDENT 0.0
.TP
.B \-f <format>
Select the output format. Starting with GDAL 2.3, if not specified,
the format is guessed from the extension (previously was ESRI
Shapefile). Use the short format name
.UNINDENT
.INDENT 0.0
.TP
.B \-single
If specified, all input vector layers will be merged into a single one.
.UNINDENT
.INDENT 0.0
.TP
.B \-nln <layer_name_template>
Name of the output vector layer (in single mode, and the default is
\(dqmerged\(dq), or template to name the output vector layers in default
mode (the default value is \fB{AUTO_NAME}\fP). The template can be a
string with the following variables that will be susbstitued with a
value computed from the input layer being processed:
.INDENT 7.0
.IP \(bu 2
\fB{AUTO_NAME}\fP: equivalent to \fB{DS_BASENAME}_{LAYER_NAME}\fP if both
values are different, or \fB{LAYER_NAME}\fP when they are identical
(case of shapefile).
.IP \(bu 2
\fB{DS_NAME}\fP: name of the source dataset
.IP \(bu 2
\fB{DS_BASENAME}\fP: base name of the source dataset
.IP \(bu 2
\fB{DS_INDEX}\fP: index of the source dataset
.IP \(bu 2
\fB{LAYER_NAME}\fP: name of the source layer
.IP \(bu 2
\fB{LAYER_INDEX}\fP: index of the source layer
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B \-update
Open an existing dataset in update mode.
.UNINDENT
.INDENT 0.0
.TP
.B \-overwrite_ds
Overwrite the existing dataset if it already exists (for file based
datasets)
.UNINDENT
.INDENT 0.0
.TP
.B \-append
Open an existing dataset in update mode, and if output layers
already exist, append the content of input layers to them.
.UNINDENT
.INDENT 0.0
.TP
.B \-overwrite_layer
Open an existing dataset in update mode, and if output layers
already exist, replace their content with the one of the input
layer.
.UNINDENT
.INDENT 0.0
.TP
.B \-src_geom_type <geom_type_name>[,<geom_type_name>]...
Only take into account input layers whose geometry type match the
type(s) specified. Valid values for geom_type_name are GEOMETRY,
POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON,
GEOMETRYCOLLECTION, CIRCULARSTRING, CURVEPOLYGON, MULTICURVE,
MULTISURFACE, CURVE, SURFACE, TRIANGLE, POLYHEDRALSURFACE and TIN.
.UNINDENT
.INDENT 0.0
.TP
.B \-dsco <NAME>=<VALUE>
Dataset creation option (format specific)
.UNINDENT
.INDENT 0.0
.TP
.B \-lco <NAME>=<VALUE>
Layer creation option (format specific)
.UNINDENT
.INDENT 0.0
.TP
.B \-a_srs <srs_def>
Assign an output SRS
.UNINDENT
.INDENT 0.0
.TP
.B \-t_srs <srs_def>
Reproject/transform to this SRS on output
.UNINDENT
.INDENT 0.0
.TP
.B \-s_srs <srs_def>
Override source SRS
.UNINDENT
.INDENT 0.0
.TP
.B \-progress
Display progress on terminal. Only works if input layers have the
\(dqfast feature count\(dq capability.
.UNINDENT
.INDENT 0.0
.TP
.B \-skipfailures
Continue after a failure, skipping the failed feature.
.UNINDENT
.INDENT 0.0
.TP
.B \-field_strategy FirstLayer|Union|Intersection
Only used with \fI\%\-single\fP\&. Determines how the schema of the target
layer is built from the schemas of the input layers. May be
FirstLayer to use the fields from the first layer found, Union to
use a super\-set of all the fields from all source layers, or
Intersection to use a sub\-set of all the common fields from all
source layers. Defaults to Union.
.UNINDENT
.INDENT 0.0
.TP
.B \-src_layer_field_name <name>
Only used with \fI\%\-single\fP\&. If specified, the schema of the target layer
will be extended with a new field \(aqname\(aq, whose content is
determined by \-src_layer_field_content.
.UNINDENT
.INDENT 0.0
.TP
.B \-src_layer_field_content <layer_name_template>
Only used with \fI\%\-single\fP\&. If specified, the schema of the target layer
will be extended with a new field (whose name is given by
\fI\%\-src_layer_field_name\fP, or \(aqsource_ds_lyr\(aq otherwise), whose
content is determined by \fBlayer_name_template\fP\&. The syntax of
\fBlayer_name_template\fP is the same as for \fI\%\-nln\fP\&.
.UNINDENT
.SH EXAMPLES
.sp
Create a VRT with a layer for each input shapefiles
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
ogrmerge.py \-f VRT \-o merged.vrt *.shp
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Same, but creates a GeoPackage file
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
ogrmerge.py \-f GPKG \-o merged.gpkg *.shp
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Concatenate the content of france.shp and germany.shp in merged.shp,
and adds a \(aqcountry\(aq field to each feature whose value is \(aqfrance\(aq or
\(aqgermany\(aq depending where it comes from.
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
ogrmerge.py \-single \-o merged.shp france.shp germany.shp \-src_layer_field_name country
.ft P
.fi
.UNINDENT
.UNINDENT
.SH AUTHOR
Even Rouault <even.rouault@spatialys.com>
.SH COPYRIGHT
1998-2024
.\" Generated by docutils manpage writer.
.
